<%@ page language="java" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/pager" prefix="pg" %>
<HTML>
    <HEAD>
        <TITLE>Search Users</TITLE>
        <LINK rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/standard.css" />
    </HEAD>
    <BODY style="margin-left: 20; margin-top:10; overflow: auto;" bgcolor="#f5f5f5">
        <TABLE cellpadding="0" cellspacing="2" border="0" align="center" width="100%" summary="Search Users" class="body">

            <!-- #### Search result #### -->
            <logic:present name="usersSearchResult" scope="session">    
            <bean:size id="usersResultSize" name="usersSearchResult" property="LResults" />
             <form name="selectedUser" action="<%=request.getContextPath()%>/selectUserCreate.do" method="POST" target="_parent">
             <TR>
               <TD colspan="2" width="100%">
                    <TABLE cellpadding="0" cellspacing="0" border="0" summary="Results" width="100%" class="body">
                       <TR>
                           <TD height="40" class="body">Select only one user, otherwise only the first will be considered !</B></TD>
					   </TR>
                       <TR>
                           <TD height="40" class="body"><IMG src="<%=request.getContextPath()%>/images/spacer.gif" width="6" height="8" border="0" alt=""></TD>
					   </TR>
                       <TR>
                           <TD height="40" class="body"><B><bean:write name="usersResultSize" /> records found</B></TD>
					   </TR>
					   <TR>
                           <TD align="center" width="80%">
				              <pg:pager url="<%=request.getContextPath() + "/showSearchUsers.do"%>" items="<%= usersResultSize.intValue() %>"
					             maxPageItems="5" maxIndexPages="5" maxItems="2000"
					             export="currentPageNumber=pageNumber,offset,pagerOffset=pageOffset" scope="request">           
                                 <pg:index>
                                    <pg:first export="firstPageUrl=pageUrl" unless="current">
                                       <a href="<%= firstPageUrl %>"><img src="<%=request.getContextPath()%>/images/first.gif"  border="0"></a>
                                    </pg:first>
                                    <pg:prev export="prevPageUrl=pageUrl">
                                       <a href="<%= prevPageUrl %>"><img src="<%=request.getContextPath()%>/images/previous.gif" border="0"></a>
                                    </pg:prev>
                                    <pg:pages>
                                       <% if (pageNumber == currentPageNumber) { %> 
                                       <b><%= pageNumber %></b>
                                       <% } else { %>
                                       <a href="<%= pageUrl %>"><%= pageNumber %></a>
                                       <% } %>
                                    </pg:pages>
                                    <pg:next export="nextPageUrl=pageUrl">
                                       <a href="<%= nextPageUrl %>"><img src="<%=request.getContextPath()%>/images/next.gif" border="0"></a>
                                    </pg:next>
                                    <pg:last export="lastPageUrl=pageUrl" unless="current">
                                       <a href="<%= lastPageUrl %>"><img src="<%=request.getContextPath()%>/images/last.gif" border="0"></a>
                                    </pg:last>
                                 </pg:index>
                           </TD>
                           <TD>
                              <IMG src="<%=request.getContextPath()%>/images/spacer.gif" width="6" height="8" border="0" alt="">
                           </TD>
                        </TR>
                        <TR>
                           <TD colspan="4">
                              <TABLE cellpadding="0" cellspacing="1" border="0" summary="Results" width="100%" class="body" style="border: solid black 1px;">							   
                                 <TR>
									<TH>&nbsp;</TH>
                                    <TH>&nbsp;Name&nbsp;</TH>
                                 </TR>
		                         <logic:iterate id="usersTempResult" indexId="searchId" name="usersSearchResult" property="LResults" scope="session">
                                 <pg:item>      
		                   			<TR>
                                       <TD width="1">
									      <input type="checkbox" name="userIndex" value="<%=searchId%>" title="Select or cancel the selection of the entry" alt="Select-Cancel"/>
                                       </TD>
									   <TD>
									      <logic:present name="usersTempResult" property="commonName">
											    <bean:write name="usersTempResult" property="commonName" />
                                          </logic:present>
									   </TD>
                                    </TR>
                                 </pg:item>
                                 </logic:iterate>
                              </pg:pager>
                             </TABLE>
					      </TD>
                        </TR>
                        <TR>
			               <TD colspan="4"><IMG src="<%=request.getContextPath()%>/images/spacer.gif" width="1" height="5" alt=""></TD>
                        </TR>
                        <TR>				
               			   <TD colspan="4" align="center">
							  <INPUT type="image" name="confirmButton" src="<%=request.getContextPath()%>/images/ok_button.gif" alt="Submit" title="Submit"/>
                          </TD>
                        </TR>
                    </TABLE>
                </TD>
            </TR>
			</form>
            </logic:present>

        </TABLE>
    </BODY>
</HTML>
